When performance of a computer program is evaluated, especially in the purpose of tuning, it is important to evaluate the performance in a unit of function or a unit of loop. To that end, for example, at the execution of a target program that is subject to a performance evaluation, a start time and a termination time of a function or loop processing are recorded, and a time that is taken for execution of the function or the loop is obtained based on a time difference between the start time and the termination time. For example, by inserting an evaluation code that calculates the time difference into a start location and a termination location of the function or the loop processing in the target program, the time that is taken for the execution of the function or the loop is obtained.
When the evaluation code is inserted into the target program that is subject to a performance evaluation as described above, two points are requested as follows. The first point is that an influence on normal execution of the program is small when the evaluation code is inserted into the program to be evaluated. For example, when an execution time of the program is increased due to the insertion of the evaluation code, problems occur that accurate evaluation of a target location is not executed, or the execution time of the whole program is extended.
The second point is that, even when a location or item to be evaluated is changed, evaluation of the program may be executed quickly and flexibly using the changed contents. The location or item to be evaluated are often changed by trial and error, and it takes a long time to execute processing of modifying and re-translating the evaluation code that has been inserted into the source code of the target program each time the location or item to be evaluated is changed.
In addition, an electronic device has been proposed by which execution speed of a program is not significantly reduced at the time of normal execution in which debug processing is not executed even when the debug processing is kept to be included in the program. The electronic device loads a debug instruction code in the program into a random access memory (RAM) while rewriting the debug instruction code into a NOP instruction code when the electronic device normally executes the program including the debug instruction code. In addition, a method of automatically inserting an evaluation code into a target program that is to be evaluated has been proposed.
As an example of the related art, Japanese Laid-open Patent Publication No. 2011-159084, Japanese Laid-open Patent Publication No. 62-169238 (corresponding to Japanese Examined Patent Application Publication No. 8-1608), Japanese Laid-open Patent Publication No. 5-241915, and Japanese Laid-open Patent Publication No. 11-242614 are known.